New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aofl/server-environment

Package Overview
Dependencies
Maintainers
3
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aofl/server-environment

Helps determine dev, stage, prod environments based on hostname

  • 1.4.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

@aofl/server-environment

Helps determine dev, stage, prod environments based on hostname.


Examples

  • https://stackblitz.com/edit/1-0-0-server-environment?embed=1

Installation

npm i -S @aofl/server-environment

Usage

import {getServerEnvironment, environmentTypeEnumerate} from '@aofl/server-environment';

const env = getServerEnvironment(/localhost/, /^stage\./);
const debugMode = (env === environmentTypeEnumerate.DEV);


Methods

getServerEnvironment

Takes a devRegex and a stageRegex and tests them against hostname. Returns 'production' if the regexes do not capture any results from hostname.

NameTypeDescription
devRegexRegExp
stageRegexRegEx

Constants

environmentTypeEnumerate

KeyValue
DEVdevelopment
STAGEstage
PRODproduction

Keywords

FAQs

Package last updated on 07 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc